package jy.project.ZhaiNv.models;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import jy.tools.toolHttp;

import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Bitmap.Config;
import android.util.Log;




public class dataSource {
	
	
	public static List<picItem> GetPicData(int pagenum){
		
		List<picItem> re = new ArrayList<picItem>();
		
		String dataUrl = "http://zhainv365.sinaapp.com/out_info.php";
		
		String txt = toolHttp.Get(dataUrl);
		
		JSONObject jsdata;
		
		try {
			jsdata = new JSONObject(txt);
			JSONArray jr = jsdata.getJSONArray("datas");
			
			for ( int i = 0;i<jr.length();i++ ){
				
				JSONObject jo = (JSONObject) jr.get(i);
				picItem pi = new picItem();
				
				Log.v("sae", "sae"+jo.getString("title"));
				
				pi.picUrl = jo.getString("picurl");
				pi.title = jo.getString("title");
				
				re.add(pi);
			}
			
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
		return re;
	}
	
	
}
